//
//  YHYRecommendHeadScrollCollectionViewCell.m
//  TripTogether
//
//  Created by 杨泓晔 on 15/12/26.
//  Copyright © 2015年 杨泓晔. All rights reserved.
//

#import "YHYRecommendHeadCollectionViewCell.h"

@interface YHYRecommendHeadCollectionViewCell ()
@property (nonatomic,retain)UIView *view;

@property (nonatomic,strong) UILabel *myLabel;
@property (nonatomic,retain)UIButton *myButton;
@property (nonatomic,retain)UIImageView *myImageView;
@end


@implementation YHYRecommendHeadCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        //self.backgroundColor = [UIColor colorWithRed:0.886 green:0.729 blue:0.690 alpha:1.000];
        
        
        
        
        _view = [UIView new];
        _view.backgroundColor = [UIColor colorWithRed:0.320 green:0.740 blue:0.800 alpha:1.000];
        [self.contentView addSubview:_view];
        
        [_view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(7, 21));
            make.top.mas_equalTo(25);
            make.left.mas_equalTo(10);
            
        }];
        //    裁掉view的边界
        _view.layer.masksToBounds = YES;
        //    设置半径
       _view.layer.cornerRadius = 3;
        
        
        _myLabel = [UILabel new];
        [self.contentView addSubview:_myLabel];
        
        [_myLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(24);
            make.left.mas_equalTo(_view.mas_right).offset(8);
            make.top.mas_equalTo(_view);
            make.right.equalTo(self.contentView.mas_right).offset(-50);
            
            
        }];
        _myLabel.text = @"每日精选故事";
        _myLabel.font = [UIFont fontWithName:@"Gill Sans" size:16];
        _myLabel.textColor = [UIColor colorWithRed:0.259 green:0.259 blue:0.263 alpha:0.900];
        
        
        _myButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.contentView addSubview:_myButton];
        [_myButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.and.top.mas_equalTo(_myLabel);
            make.right.mas_equalTo(-24);
            make.width.mas_equalTo(40);
            
        }];
        [_myButton setTitle:@"全部" forState:UIControlStateNormal];
        [_myButton setTitleColor:[UIColor colorWithWhite:0.761 alpha:1.000] forState:UIControlStateNormal];
        _myButton.titleLabel.font = [UIFont fontWithName:@"Gill Sans" size:15];
        [_myButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside ];
        
        
        
        _myImageView = [UIImageView new];
        //_myImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_myImageView];
        
        [_myImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-9);
            make.top.mas_equalTo(_view);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(15);
            
        }];
        _myImageView.image = [UIImage imageNamed:@"iconfont-061867-2.png"];
        
        
      
           }
    return self;
}
- (void)buttonAction:(UIButton *)btu{
    [self.myDelegate presentButtonDeleagte];
}

- (void)setValue:(NSString *)str isHidden:(BOOL)hidden
{
    _myLabel.text = str;
    _myButton.hidden = hidden;
    _myImageView.hidden = hidden;
}
@end
